'''
#显示日期列表
import datetime
def get_date_range(begin_date, end_date):
    date_list = []
    while begin_date <= end_date:
        date_list.append(begin_date)
        begin_date_object = datetime.datetime.strptime(begin_date, '%Y-%m-%d')
        days1_timedelta = datetime.timedelta(days=1)
        begin_date = (begin_date_object + days1_timedelta).strptime('%Y-%m-%d')
    return date_list

begin_date = "2025-07-28"
end_date = "2025-08-03"
date_list = get_date_range(begin_date, end_date)
print(date_list)
'''

import datetime
def get_date_range(begin_date, end_date):
    date_list = []
    begin_date_object = datetime.datetime.strptime(begin_date, '%Y-%m-%d')  # 移到循环外
    end_date_object = datetime.datetime.strptime(end_date, '%Y-%m-%d')      # 添加结束日期转换
    
    while begin_date_object <= end_date_object:
        date_list.append(begin_date_object.strftime('%Y-%m-%d'))  # 修改为strftime格式化
        begin_date_object += datetime.timedelta(days=1)  # 直接操作日期对象
        
    return date_list

begin_date = "2025-07-28"
end_date = "2025-08-03"
date_list = get_date_range(begin_date, end_date)
print(date_list)